<?php 
include_once(''.P.'/public/headerwe.html');
?>

<script>

function getpassobj(){
	return $('input[type=password]');
}
function loginsubmit(){
	var user = form('rockofficeuser').value,pass=getpassobj().val();
	if(!user){
		js.msgerror('请输入用户名');return;
	}
	if(!pass){
		js.msgerror('请输入密码');return;
	}
	js.loading('登录中...');
	var odg = get('loginbtn');
	js.setoption('lguser', user);
	js.setoption('lgpass', pass);
	odg.disabled=true;
	js.ajax({
		url:'?m=login&a=logincheck',data:{user:user,pass:pass,device:device,cform:'we'},
		type:'post',
		dataType:'json',
		success:function(ret){
			if(!ret.success){
				odg.disabled=false;
				js.msgerror(ret.msg);
			}else{
				js.setoption('lgface', ret.data.face);
				get('imglogo').src = ret.data.face;
				js.setoption('admintoken', ret.data.token);
				js.loading('登录成功跳转中');
				var burl = js.request('backurl');
				if(burl)burl = jm.base64decode(burl);
				if(!burl)burl= '?d=we';
				js.location(burl);
			}
		}
	});
}
function initbody(){
	form('rockofficeuser').value = js.getoption('lguser');
	getpassobj().val(js.getoption('lgpass'));
	var fac = js.getoption('lgface');
	if(fac)get('imglogo').src = fac;
}
</script>

</head>

<body scroll="no" style="overflow:hidden">


<div style="text-align:center;margin-top:20px">
	<div><img id="imglogo" style="height:100px;width:100px;border-radius:50%" onclick="location.reload()" src="images/noface.png"></div>
</div>

<form name="myform">	
<div class="weui-cells weui-cells-form">
	<div id="loginview0">
		<div class="weui-cell">
			<div class="weui-cell__hd"><label style="width:70px" class="weui-label">帐号</label></div>
			<div class="weui_cell-bd weui-cell-primary">
				<input class="weui-input" type="text" value="" onKeyUp="if(event.keyCode==13)getpassobj().focus()" value="" autocomplete="off"  onfocus="$('#loginfooter').hide()" placeholder="请输入帐号" name="rockofficeuser" autocomplete="off" maxlength="100" placeholder="用户名/姓名/手机号"/>
			</div>
		</div>

		<div class="weui-cell">
			<div class="weui-cell__hd"><label style="width:70px" class="weui-label">密码</label></div>
			<div class="weui-cell__bd weui-cell-primary">
				<input class="weui-input" onfocus="$('#loginfooter').hide()" autocomplete="off" onclick="this.focus()"  type="password" onkeyup="if(event.keyCode==13)loginsubmit()"  placeholder="请输入密码"/>
			</div>
		</div>
	</div>
	
</div>
</form>

<div align="center" style="margin-top:24px">
	<button class="webbtn webbtn_big" id="loginbtn" type="button" onclick="loginsubmit()">登录</button>
</div>

<div id="loginfooter" class="weui-footer weui-footer_fixed-bottom">
	<p class="weui-footer__text" id="loginstring" style="color:#cccccc"><?=TITLE?></p>
</div>


</body>
</html>